package com.shop.cloud.filter;

import javax.servlet.ServletContext;

import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.web.context.ServletContextAware;

/**
 * @description: 初始化
 */
public class InitializationListener implements ServletContextAware, ApplicationListener<ContextRefreshedEvent> {

	private ServletContext servletContext;

	public void setServletContext(ServletContext servletContext) {
		this.servletContext = servletContext;
	}
	
	@Override
	public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) {
		if (servletContext != null && contextRefreshedEvent.getApplicationContext().getParent() == null) {
			
			System.err.println("----------InitializationListener----------");
		}
	}
}